#include "ODN_Events.h"

#include "ODN_GameMgr.h"

namespace ouden {

/*IEvent::IEvent()
{
	//ctor
}

IEvent::~IEvent()
{
	//dtor
}*/

void C_ClientEvent::activate()
{
	//If we're a client then send to the server. Otherwise we're a 
	// server acting as a client, so just activate it
	if (CGameMgr::getInstance()->isClient())
		onSend();
	//Apply the event locally
	onActivate();
}

void CServerEvent::activate()
{
	//Send the event to all the clients
	onSend();
	//If we're a server acting as a client then activate locally, otherwise 
	// if we are a dedicated server, don't activate it locally
	//TODO: Work out how to do isDedicatedServer()
	//if (!CGameMgr::getInstance()->isDedicatedServer())
		//Apply the event locally
		onActivate();
}

} //namespace ouden
